package InputFormat;

import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import java.io.IOException;
//自定义的InputFormat(将多个小的文件合并为一个大文件)
public class FilesInputFormat  extends FileInputFormat<Text, BytesWritable> {


    @Override
    public RecordReader<Text, BytesWritable> createRecordReader(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException {
        //new  FilesRecordReader类 在类实现里面写主要逻辑
        FilesRecordReader recordReader = new  FilesRecordReader();
        return recordReader;
    }
}
